package com.sungohealth.service.impl;

import com.sungohealth.entity.Sleep;
import com.sungohealth.service.ISleepService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 睡眠业务实现层
 *
 * @author :Liangzy (Potato)
 * @date: 2022-05-03 21:47
 */
@Service
public class SleepServiceImpl implements ISleepService {


    /**
     * 假设返回数据为处理完成之后的数据
     */
    @Override
    public List<Sleep> getSleepDataByUserId(String userId) {
        return sleepDataMock()
                .stream()
                .filter(x -> x.getUserId().equals(Long.valueOf(userId)))
                .collect(Collectors.toList());
    }

    private List<Sleep> sleepDataMock() {
        List<Sleep> sleeps = new ArrayList<>();
        Sleep sleep = new Sleep();
        sleep.setSleepId(0L);
        sleep.setUserId(1234L);
        sleep.setDateData(new Date());
        sleep.setSleepData("");
        sleep.setSleepNap("");
        sleep.setNapTime("");
        sleep.setOriginalSleepData("");
        sleep.setHrSleepData("");
        sleep.setScoreTime("");
        sleep.setScoreDuration("");
        sleep.setScoreQuality("");
        sleep.setScoreSpeed("");
        sleep.setSleepCode("");
        sleep.setDeepSleep("");
        sleep.setLightSleep("");
        sleep.setException("");
        sleep.setFallAsleepTime(new Date());
        sleep.setAwakeningTime(new Date());
        sleep.setExceptionNum(0);
        sleep.setAllSleep("");
        sleep.setUpdateTime(new Date());
        sleep.setAddTime(new Date());
        sleep.setBandUpdateTime(new Date());
        sleep.setStatus("");
        sleep.setMinAll("");
        Sleep sleep2 = new Sleep();
        sleep2.setSleepId(0L);
        sleep2.setUserId(1234L);
        sleep2.setDateData(new Date());
        sleep2.setSleepData("");
        sleep2.setSleepNap("");
        sleep2.setNapTime("");
        sleep2.setOriginalSleepData("");
        sleep2.setHrSleepData("");
        sleep2.setScoreTime("");
        sleep2.setScoreDuration("");
        sleep2.setScoreQuality("");
        sleep2.setScoreSpeed("");
        sleep2.setSleepCode("");
        sleep2.setDeepSleep("");
        sleep2.setLightSleep("");
        sleep2.setException("");
        sleep2.setFallAsleepTime(new Date());
        sleep2.setAwakeningTime(new Date());
        sleep2.setExceptionNum(0);
        sleep2.setAllSleep("");
        sleep2.setUpdateTime(new Date());
        sleep2.setAddTime(new Date());
        sleep2.setBandUpdateTime(new Date());
        sleep2.setStatus("");
        sleep2.setMinAll("");
        Sleep sleep3 = new Sleep();
        sleep3.setSleepId(0L);
        sleep3.setUserId(1234L);
        sleep3.setDateData(new Date());
        sleep3.setSleepData("");
        sleep3.setSleepNap("");
        sleep3.setNapTime("");
        sleep3.setOriginalSleepData("");
        sleep3.setHrSleepData("");
        sleep3.setScoreTime("");
        sleep3.setScoreDuration("");
        sleep3.setScoreQuality("");
        sleep3.setScoreSpeed("");
        sleep3.setSleepCode("");
        sleep3.setDeepSleep("");
        sleep3.setLightSleep("");
        sleep3.setException("");
        sleep3.setFallAsleepTime(new Date());
        sleep3.setAwakeningTime(new Date());
        sleep3.setExceptionNum(0);
        sleep3.setAllSleep("");
        sleep3.setUpdateTime(new Date());
        sleep3.setAddTime(new Date());
        sleep3.setBandUpdateTime(new Date());
        sleep3.setStatus("");
        sleep3.setMinAll("");
        Sleep sleep4 = new Sleep();
        sleep4.setSleepId(0L);
        sleep4.setUserId(87819234L);
        sleep4.setDateData(new Date());
        sleep4.setSleepData("");
        sleep4.setSleepNap("");
        sleep4.setNapTime("");
        sleep4.setOriginalSleepData("");
        sleep4.setHrSleepData("");
        sleep4.setScoreTime("");
        sleep4.setScoreDuration("");
        sleep4.setScoreQuality("");
        sleep4.setScoreSpeed("");
        sleep4.setSleepCode("");
        sleep4.setDeepSleep("");
        sleep4.setLightSleep("");
        sleep4.setException("");
        sleep4.setFallAsleepTime(new Date());
        sleep4.setAwakeningTime(new Date());
        sleep4.setExceptionNum(0);
        sleep4.setAllSleep("");
        sleep4.setUpdateTime(new Date());
        sleep4.setAddTime(new Date());
        sleep4.setBandUpdateTime(new Date());
        sleep4.setStatus("");
        sleep4.setMinAll("");
        sleeps.add(sleep);
        sleeps.add(sleep2);
        sleeps.add(sleep3);
        sleeps.add(sleep4);

        return sleeps;
    }
}
